﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using models;

namespace yuejilalala
{
    public partial class Login : System.Web.UI.Page
    {
        UserMarager marager = new UserMarager();
        public static string dizhi = "images/";
        
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["dizhi"] = dizhi;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            User user = marager.Getdl(this.TextBox1.Text, this.TextBox2.Text);

            if (user != null)
            {
                //将登录对象存储都Session中
                Session["sess"] = user;
                Session["sessid"] = user.Id;
                Response.Write("<script>alert('登录成功')</script>");
                Response.Redirect("home.aspx");

            }
            else
            {
                Response.Write("<script>alert('登录失败')</script>");
            }
        }
    }
}